<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>曲阜公益文章列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <style type="text/css">

/* tooltip */
#tooltip{
  position:absolute;
  border:1px solid #ccc;
  background:#333;
  padding:2px;
  display:none;
  color:#fff;
}
</style>
</head>
<body>
<fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
  <form class="layui-form serch" action="{:url('admin/Publicwelfare/index')}" method="post">
    <div class="layui-form-item" style="float: left;">
      <div class="layui-input-inline">
        <input type="text" name="keyword" lay-verify="title" autocomplete="off" placeholder="请输入关键词" class="layui-input layui-btn-sm" value="{$Request.param.keyword}">
      </div>
      <div class="layui-input-inline">
        <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input layui-btn-sm" value="{$Request.param.title}">
      </div>
      <div class="layui-input-inline">
        <div class="layui-inline">
          <div class="layui-input-inline">
            <input type="text" class="layui-input" id="start_time" placeholder="发布开始时间" name="start_time">
          </div>
        </div>
      </div>
      <div class="layui-input-inline">
        <div class="layui-inline">
          <div class="layui-input-inline">
            <input type="text" class="layui-input" id="end_time" placeholder="发布结束时间" name="end_time">
          </div>
        </div>
      </div>
      <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
      <a href="{:url('admin/Publicwelfare/index')}" class="layui-btn layui-btn-sm layui-btn-primary">清空</a>
      <a href="{:url('admin/Publicwelfare/add')}" class="layui-btn layui-btn-sm a_menu">
        添加文章
      </a>
    </div>
  </form> 
  
</fieldset>
<table class="layui-table" lay-even="" lay-skin="row" lay-size="sm">
  <colgroup>
    <col width="50">
    <col width="50">
    <col width="100">
    <col width="60">
    <col width="50">
    <col width="60">
    <col width="50">
    <col width="100">
    <col width="50">
    <col width="100">
  </colgroup>
  <thead>
    <tr>
      <th>ID</th>
      <th>标题</th>
      <th>描述</th>
      <th>关键字</th>
      <th>来源</th>
      <th>作者</th>
      <th>阅读量</th>
      <th>创建时间</th>
      <th>状态</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
    {volist name="data" id="vo"}
      <tr>
        <td>{$vo.id}</td>
        <td>{$vo.title}</td>
        <td>{$vo.desc}</td>
        <td>{$vo.keyword}</td>
        <td>{$vo.from}</td>
        <td>{$vo.author}</td>
        <td>{$vo.read_num}</td>
        <td>{$vo.create_time}</td>
        <td>{$vo.status}</td>
        <td class="operation-menu">
          <a href="{:url('admin/article/publish',['id'=>1])}" class="layui-btn layui-btn-xs a_menu" style="margin-right: 0;font-size:12px;">修改</a>
          <a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger delete" id="1" style="margin-right: 0;font-size:12px;">删除</a>
        </td>
      </tr>
    {/volist}
  </tbody>
</table>
<div>{$page}</div>
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
    var message;
    layui.config({
        base: '__JS__/',
        version: '1.0.1'
    }).use(['app', 'message'], function() {
        var app = layui.app,
            $ = layui.jquery,
            layer = layui.layer;
        //将message设置为全局以便子页面调用
        message = layui.message;
        //主入口
        app.set({
            type: 'iframe'
        }).init();
    });
</script>
<script type="text/javascript">
$('.delete').click(function(){
  var id = $(this).attr('id');
  layer.confirm('确定要删除?', function(index) {
    $.ajax({
      url:"{:url('admin/article/delete')}",
      data:{id:id},
      success:function(res) {
        layer.msg(res.msg);
        if(res.code == 1) {
          setTimeout(function(){
            location.href = res.url;
          },1500)
        }
      }
    })
  })
})
</script>
<script type="text/javascript">
</script>
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  //常规用法
  laydate.render({
    elem: '#start_time',
    type: 'datetime',
    value: "{$start_time}"
  });
  laydate.render({
    elem: '#end_time',
    type: 'datetime',
    value: "{$end_time}"
  });
});
</script>
</body>
</html>
